package com.tube.fiddles.support.dao;

import java.util.Map;

import javax.persistence.LockModeType;
import javax.persistence.Query;
import javax.persistence.TypedQuery;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import javax.persistence.metamodel.Metamodel;

public interface IGenericDao {

    public void persist(Object entity);

    public <T> T merge(T entity);

    public void remove(Object entity);

    public void refresh(Object entity);

    public void refresh(Object entity, LockModeType lockMode);

    public void refresh(Object entity, Map<String, Object> properties);

    public void refresh(Object entity, LockModeType lockMode, Map<String, Object> properties);

    public void clear();

    public void detach(Object entity);

    public void flush();

    public boolean contains(Object entity);

    public Metamodel getMetamodel();

    public CriteriaBuilder getCriteriaBuilder();

    public <T> T getReference(Class<T> entityClass, Object primaryKey);

    public Query createNativeQuery(String sqlString);

    public Query createNativeQuery(String sqlString, Class<?> resultClass);

    public Query createNativeQuery(String sqlString, String resultSetMapping);

    public Query createNamedQuery(String name);

    public <T> TypedQuery<T> createNamedQuery(String name, Class<T> resultClass);

    public Query createQuery(String qlString);

    public <T> TypedQuery<T> createQuery(CriteriaQuery<T> criteriaQuery);

    public <T> TypedQuery<T> createQuery(String qlString, Class<T> resultClass);

    public <T> T find(Class<T> entityClass, Object primaryKey);

    public <T> T find(Class<T> entityClass, Object primaryKey, Map<String, Object> properties);

    public <T> T find(Class<T> entityClass, Object primaryKey, LockModeType lockMode, Map<String, Object> properties);
    
}
